package com.jiang.service;

import com.jiang.mapper.UserMapper;
import com.jiang.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 千锋健哥
 */
@Service("service1")
public class UserServiceImpl implements UserService {

    //需要被注入的用户dao全局对象
    @Autowired
    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }
    @Value("${jdbc.url}")
    String sql ;


    @Value("${jdbc.username}")
    String name;

    public List<User> findALL() {
        //直接用注入的UserMapper对象
        List<User> list = userMapper.findUserAll();
        System.out.println(list+"================="+sql);
        System.out.println(name+"================="+sql);
        System.out.println("================"+sql);
        return list;
    }

}
